package com.sunyard.pcc;

import java.util.ResourceBundle;

public class CodeResourceUtil {

    private static final ResourceBundle bundle = ResourceBundle.getBundle("jeecg/jeecg_database");
    private static final ResourceBundle pathBundle = ResourceBundle.getBundle("jeecg/jeecg_config");


    public static String driverName;
    public static String url;
    public static String userName;
    public static String password;
    public static String databaseName;

    public static String databaseType = "mysql";
    public static String databaseTypeMysql = "mysql";

    public static String jeecgUiFieldSearchNum = "3";

    public static String webRootPackage;
    public static String resourceBootPackage;
    public static String sourceBootPackage;
    public static String basePackage;
    public static String basePackageUrl;

    public static String entityPackage;
    public static String entityUrl;
    public static String pagePackage;
    public static String pageUrl;


    public static String templatePath;
    public static String systemEncoding;
    public static String jeecgGenerateTableId;
    public static String organization;

    private void ResourceUtil() {

    }


    static {
        driverName = getDriverName();
        url = getUrl();
        userName = getUserName();
        password = getPassword();
        databaseName = getDatabaseName();
        jeecgUiFieldSearchNum = getJeecgUiFieldSearchNum();
        resourceBootPackage = getResourceBootPackage().replace(".", "/");
        webRootPackage = getWebRootPackage().replace(".", "/");
        sourceBootPackage = getSourceBootPackage().replace(".", "/");
        basePackage = getBasePackage();
        basePackageUrl = basePackage.replace(".", "/");
        entityPackage = getEntityPackage();
        pagePackage = getPagePackage();
        templatePath = getTemplatePath();
        systemEncoding = getSystemEncoding();
        jeecgGenerateTableId = getJeecgGenerateTableId();
        organization = getOrganization();


        entityUrl = sourceBootPackage + "/" + basePackage + "/" + entityPackage + "/";
        pageUrl = sourceBootPackage + "/" + basePackage + "/" + pagePackage + "/";

    }

    public static String getDriverName() {
        return bundle.getString("driver_name");
    }

    public static String getUrl() {
        return bundle.getString("url");
    }

    public static String getUserName() {
        return bundle.getString("username");
    }

    public static String getPassword() {
        return bundle.getString("password");
    }

    public static String getDatabaseName() {
        return bundle.getString("database_name");
    }

    public static String getBasePackage() {
        return pathBundle.getString("base_package");
    }

    public static String getEntityPackage() {
        return pathBundle.getString("entity_package");
    }

    public static String getPagePackage() {
        return pathBundle.getString("page_package");
    }

    public static String getSourceBootPackage() {
        return pathBundle.getString("source_root_package");
    }

    public static String getResourceBootPackage() {
        return pathBundle.getString("resource_root_package");
    }

    public static String getTemplatePath() {
        return pathBundle.getString("templatepath");
    }

    public static String getSystemEncoding() {
        return pathBundle.getString("system_encoding");
    }

    public static String getJeecgGenerateTableId() {
        return pathBundle.getString("jeecg_generate_table_id");
    }

    public static String getJeecgUiFieldSearchNum() {
        return pathBundle.getString("jeecg_ui_search_filed_num");
    }

    public static String getOrganization() {
        return pathBundle.getString("organization");
    }

    public static String getWebRootPackage() {
        return pathBundle.getString("webroot_package");
    }
}
